def lenError (Exception):
    raise '长度不合法'

uesrname =input('请输入信息')
try:
    if(len(uesrname)>=6) and (len(uesrname)<=18):
        print('用户名合法')
    else:
        raise lenError()
except lenError as e:
    print(e)